<?php
/** @var OportunidadController $this */
/** @var Oportunidad $model */
/** @var AweActiveForm $form */
// Prevenir que jquery se cargue dos veces
Yii::app()->clientScript->scriptMap['jquery.js'] = false;
Yii::app()->clientScript->scriptMap['jquery.min.js'] = false;
Util::tsRegisterAssetJs('_form_modal.js');
$form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array(
    'id' => 'entidad-form',
    'type' => 'horizontal',
//    'action' => $model->isNewRecord ? Yii::app()->createUrl('/crm/empresa/create') : Yii::app()->createUrl('/crm/empresa/update', array('id' => $model->id)),
    'enableAjaxValidation' => true,
    'clientOptions' => array('validateOnSubmit' => false, 'validateOnChange' => false,),
    'enableClientValidation' => false,
        ));
$mensaje = $model->isNewRecord ? "Nueva" . " " . $model->label(1) : "Actualizar" . " " . $model->label(1);
?>
<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            <h4 class="modal-title" id="myModalLabel"><?php echo $mensaje ?></h4>
        </div>
        <div class="modal-body">
           <?php echo $form->textFieldGroup($model, 'razon_social', array('maxlength' => 64)) ?>
            <?php echo $form->textFieldGroup($model, 'nombre', array('maxlength' => 64)) ?>
            <?php echo $form->textAreaGroup($model, 'atencion', array('maxlength' => 45)) ?>
            <?php echo $form->textAreaGroup($model, 'descripcion', array('rows' => 3, 'cols' => 50)) ?>
            <?php echo $form->textFieldGroup($model, 'website', array('maxlength' => 45)) ?>
            <?php echo $form->textFieldGroup($model, 'razon_social', array('maxlength' => 64)) ?>

            <div class="row-fluid" >

                <div class="col-lg-6">
                    <?php echo $form->textFieldGroup($model, 'documento', array('maxlength' => 20)) ?>
                    <?php echo $form->textFieldGroup($model, 'email', array('maxlength' => 45)) ?>

                </div>    
                <div class="col-lg-6">
                    <?php echo $form->textFieldGroup($model, 'telefono', array('maxlength' => 45)) ?>
                    <?php echo $form->textFieldGroup($model, 'celular', array('maxlength' => 45)) ?>
                </div>    

            </div>
            <div class="row-fluid" >

                <div class="col-lg-6">
                    <?php echo $form->dropDownListGroup($model, 'industria_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-12',), 'widgetOptions' => array('data' => array('' => ' -- Seleccione -- ') + CHtml::listData(Industria::model()->findAll(), 'id', Industria::representingColumn()), 'htmlOptions' => array('empty' => Yii::t('AweApp', 'None')),))) ?>

                </div>    
                <div class="col-lg-6">
                    <?php echo $form->dropDownListGroup($model, 'categoria_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-12',), 'widgetOptions' => array('data' => array('' => ' -- Seleccione -- ') + CHtml::listData(Categoria::model()->findAll(), 'id', Categoria::representingColumn()), 'htmlOptions' => array('empty' => Yii::t('AweApp', 'None')),))) ?>
                </div>    

            </div>
        </div>
        <div class="modal-footer">
            <?php
            $this->widget('booster.widgets.TbButton', array(
                'buttonType' => 'success',
                'icon' => 'ok',
                'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'),
                'htmlOptions' => array(
                    'onClick' => 'js:actualizarEmpresa("#entidad-form")',
                    'class' => "btn btn-sm btn-default"
                )
            ));
            ?>
            <button type="button" class="btn btn-sm btn-dark" data-dismiss="modal">Close</button>

        </div>
    </div>
</div>
<?php $this->endWidget(); ?>
